const mongoose = require('mongoose');
const https = require('https');

const options = {
  hostname: 'restapi.amap.com',
  path: encodeURI('/v3/geocode/geo?key=2a71c4cc4764ab17ca28f136a0bb5f6b&address=遵义&output=JSON'),
  method: 'GET'
};

const req = https.request(options, res => {
  console.log(`状态码: ${res.statusCode}`);

  res.on('data', d => {
    console.log(d);
    // console.log(typeof d);
    // const item = JSON.parse(d);
    // console.log(item.geocodes[0].location);
  })
})

req.on('error', error => {
  console.error(error)
})

req.end()
